<template>
  <div>
    <el-table
      :data="tableData"
      stripe
      style="width: 100%"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column type="index" label="序号" width="50"></el-table-column>
      <el-table-column prop="hash.carid" label="车辆编号"></el-table-column>
      <el-table-column prop="hash.carno" label="牌照"></el-table-column>
      <el-table-column prop="hash.cartype" label="车型&排量"></el-table-column>
      <!-- <el-table-column
        prop="hash.cartype.split('&')"
        label="排量"
      >
      </el-table-column>-->
      <el-table-column prop="hash.paytime" label="购置日期"></el-table-column>
      <el-table-column prop="hash.branch" label="所属部门"></el-table-column>
      <el-table-column prop="hash.holder" label="负责人"></el-table-column>
    </el-table>
    <el-pagination
      @current-change="handleCurrentChange"
      :currentPage.sync="pagobj.currentPage3"
      :pageSize="pagobj.pagesize"
      layout="total, prev, pager, next"
      :total="pagobj.total"
      style="margin:20px 0;text-align:center"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dialogImageUrl: "",
      dialogVisible2: false,
      dialogVisible: false,
      ts: this.newStore()
    };
  },
  props: {
    tableData: {
      type: Array,
      required: true
    },
    pagobj: {
      type: Object,
      required: true
    }
  },
  methods: {
    handleCurrentChange() {
      this.$parent.getcarlist();
    },
    handleSelectionChange(val) {
      this.$emit('update:itemval1',val)
      //console.log(val, "888");
      if (val.length > 0) {
        const req = {
          handle: "0E56125B90D2898A1AA44CCFE5972D89DADB28EFE659DCF9",
          carid: val[0].hash.carid
        };
        this.spost(this.ts, "/mainservlet", req).then(ts => {
          if (ts.d.sflag == "success") {
            this.$emit("itemvals", ts.d.data.operation1);
            //this.branchidlist=ts.d.data.operation1[0],
            //console.log(this.branchidlist.hash.holder,'999');
          }
        });
      }

      // console.log(itemvals,'2');
    },
    handleRemove(file, fileList) {
     // console.log(file, fileList);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible2 = true;
    }
  }
};
</script>

<style>
.cell {
  text-align: center;
}
</style>
